home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / comms / other / ftransapiv1.3 / arexx / ftransyam.rexx < prev   
OS/2 REXX Batch file  |  1999-11-30  |  3KB  |  116 lines

  1. /* 
  2.  
  3.  -------------------------------------
  4.  Yam Translator By FTranslator Client
  5.  
  6.  Script by Cristian Robert Gallas
  7.  
  8.  Tested on Yam 2.0 preview 5
  9.  Usage:                                
  10.  Use in ARexx interface of Yam
  11.  $VER: FTransYAM.rexx v1.0 (25.09.99)
  12.  -------------------------------------
  13.  
  14.  HISTORY
  15.  ----------------------------------------
  16.  v0.01b [16.08.98] - First public beta version.
  17.  v1.0   [25.09.99] - Modified to FTrans 1.2 API;
  18.  ----------------------------------------
  19.  
  20.  [Steps installation]
  21.  
  22.  > Copy FTransYAM.rexx to Yam:Rexx/
  23.  > Go to Yam Configuration
  24.  > Select ARexx folder
  25.  > Select 'Scripts' menu entry X
  26.  > Name   --> Port->Eng (example: Portugues to English)
  27.  > Script --> Yam:Rexx/FTransYam.rexx 3 mail (3 is a translation direction)
  28.    OBS: mail    = open translation in writemail window
  29.         request = open translation in request window
  30.  > Select ARexx on combobox
  31.  > Don`t select
  32.    Open console window
  33.    Wait for termination
  34.  > Select text and select on menu Port->Eng and see! :)
  35.  
  36.  0 - English   to Francais
  37.  1 - English   to Deutsch
  38.  2 - English   to Italiano
  39.  3 - English   to Portugues
  40.  4 - English   to Espanol
  41.  5 - Francais  to English
  42.  6 - Deutsch   to English
  43.  7 - Italiano  to English
  44.  8 - Espanol   to English
  45.  9 - Portugues to English
  46.  
  47. */
  48.  
  49. Options Results
  50.  
  51. tmpfile = 'Ram:FTransTmp.YAM'
  52. tmpclip = 'Ram:FTransYam.Clip'
  53.  
  54. ARG traduz opcao
  55.  
  56. /* TESTA SE PODE SER USADAS AS LIBS DO AREXX */
  57. if ~show(l, "rexxsupport.library") then
  58.   if ~addlib("rexxsupport.library", 0, -30) then
  59.     exit
  60. if ~show(l, "rexxtricks.library") then
  61.   if ~addlib("rexxtricks.library", 0, -30) then
  62.     exit
  63.  
  64. /* TESTA SE O PROGRAMA JA NAO ESTA COM A PORTA DE TRADUCAO ABERTA */
  65. if exists(tmpfile) then do
  66.   Request '"FTranslation port is open! Translation in progress, wait..." "_Ok"'
  67.   exit
  68. end
  69.  
  70. /* COLOCA COMO DEFAULT PORTUGUES TO ENGLISH */
  71. if traduz = "" then
  72.   traduz = 3
  73.  
  74. /* PEGA O CONTEUDO DO CLIPBOARD */
  75. sel = ReadClipboard(0)
  76.  
  77. /* TESTA SE O CLIPBOARD ESTA VAZIO */
  78. if sel = '' then do
  79.   Request '"You need select text first, clipboard is empty..." "_Ok"'
  80.   exit
  81. end
  82.  
  83. call open(1, tmpclip, 'W')
  84. call writeln(1, sel)
  85. call close(1)
  86.  
  87. /* EXECUTA O FTRANSLATOR COM OS ARGUMENTOS DA TRADUCAO */
  88. comando = 'C:FTranslator -f "'tmpclip'" -d 'traduz' SILENCE > 'tmpfile
  89. Address Command comando
  90. call delete(tmpclip)
  91.  
  92. /* SE USAR A OPCAO DE WRITEMAIL */
  93. if (opcao = "") | (lower(opcao) = "mail") then do
  94.   MAILWRITE
  95.   WRITELETTER FILE tmpfile
  96.   call delete(tmpfile)
  97.   exit
  98. end
  99.  
  100. /* SE USAR A OPCAO DE REQUEST */
  101. if lower(opcao) = "request" then do
  102.   goodopen=open(1, tmpfile, 'R')
  103.   linein = ''
  104.   if goodopen then do
  105.     do until eof(1)
  106.       linein = linein'*N 'readln(1)
  107.     end
  108.   end
  109.   close(1)
  110.   call delete(tmpfile)
  111.   linein = compress(linein, '"')
  112.   Request '" 'linein' " "_Ok"'
  113. end
  114.  
  115. exit
  116.